﻿using PetaPoco;
using PmSoft;
using PmSoft.Caching;
using System.ComponentModel;
using static Modules.Payroll.PayrollConstants;
using static Modules.Project.ProjectConstants;
using static Modules.System.Flow.FlowConstants;

namespace Modules
{
    /// <summary>
    /// 项目停复工记录
    ///</summary>
    [TableName("project_lock_out")]
    [Description("项目停复工记录【申请、审批】")]
    [PrimaryKey("id", AutoIncrement = true)]
    [CacheSetting(true, PropertyNamesOfArea = "ProjectId,Status")]
    [Serializable]
    public class ProjectLockOut : IEntity
    {
        /// <summary>
        /// 主键
        ///</summary>
        [Column("id")]
        public int Id { get; set; }

        /// <summary>
        /// 项目id
        ///</summary>
        [Column("project_id")]
        public int ProjectId { get; set; }

        /// <summary>
        /// 申请状态（1：停工   2：复工）
        ///</summary>
        [Column("status")]
        public 停复工申请状态 Status { get; set; }

        /// <summary>
        /// 计划停工开始日期
        ///</summary>
        [Column("plan_start_date")]
        public DateTime? PlanStartDate { get; set; }

        /// <summary>
        /// 计划停工结束日期（复工日期）
        ///</summary>
        [Column("plan_end_date")]
        public DateTime? PlanEndDate { get; set; }

        /// <summary>
        /// 实际停工开始日期
        ///</summary>
        [Column("start_date")]
        public DateTime? StartDate { get; set; }

        /// <summary>
        /// 实际复工日期
        ///</summary>
        [Column("end_date")]
        public DateTime? EndDate { get; set; }

        /// <summary>
        /// 原因
        ///</summary>
        [Column("reason")]
        public string Reason { get; set; }

        /// <summary>
        /// 脚本执行状态（0：未执行   1：已执行）
        ///</summary>
        [Column("job_status")]
        public int? JobStatus { get; set; }

        /// <summary>
        /// 创建时间
        ///</summary>
        [Column("create_time")]
        public DateTime CreateTime { get; set; }

        /// <summary>
        /// 流程编码
        ///</summary>
        [Column("flow_code")]
        public string FlowCode { get; set; }

        /// <summary>
        /// 流程步骤编码
        ///</summary>
        [Column("flow_engine_code")]
        public FlowEngine? FlowEngineCode { get; set; }

        /// <summary>
        /// 审核类型
        ///</summary>
        [Column("audit_type")]
        public 审核类型 AuditType { get; set; }

        /// <summary>
        /// 审核状态
        ///</summary>
        [Column("audit_status")]
        public 审核状态 AuditStatus { get; set; }

        /// <summary>
        /// 脚本执行时间
        ///</summary>
        [Column("job_run_time")]
        public DateTime JobRunTime { get; set; }

        #region IEntity 成员

        [Ignore]
        object IEntity.EntityId { get { return this.Id; } }

        #endregion IEntity 成员
    }
}